﻿using System.Data.Entity.ModelConfiguration;

namespace wh40klbModel.ModelConfiguration
{
    class InfantryConfigration : EntityTypeConfiguration<Infantry>
    {
        public InfantryConfigration()
        {

            //Cle Primaire et table
            HasKey(s => s.Id);
            ToTable("Infantries");
            //Propriete
            Property(i => i.Name).IsRequired().HasMaxLength(25);
            Property(i => i.WeaponSkill).IsRequired();
            Property(i => i.BallisticSkill).IsRequired();
            Property(i => i.Strengh).IsRequired();
            Property(i => i.Thoughness).IsRequired();
            Property(i => i.Wounds).IsRequired();
            Property(i => i.Initiative).IsRequired();
            Property(i => i.Leadership).IsRequired();
            Property(i => i.Attack).IsRequired();
            Property(i => i.ArmorSave).IsRequired();
            Property(i => i.Description).IsOptional();
            //cle etrangere
            HasRequired(i => i.Army).WithMany(a => a.Infantries);
        }
    }
}
